//
//  LFNavigationController.m
//  LoveFruit
//
//  Created by 张令林 on 16/9/22.
//  Copyright © 2016年 张令林. All rights reserved.
//

#import "LFNavigationController.h"

@interface LFNavigationController ()

@end

@implementation LFNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    
}

#pragma mark - 重写返回按钮的方法
+(void)initialize
{
    // 获取特定类的所有导航条
    UINavigationBar *navigationBar = [UINavigationBar appearanceWhenContainedInInstancesOfClasses:@[[UIViewController class]]];
    // 方式1：使用自己的图片替换原来的返回图片
    navigationBar.backIndicatorImage = [UIImage imageNamed:@"backbtn"];
    navigationBar.backIndicatorTransitionMaskImage = [UIImage imageNamed:@"backbtn"];
    // 方式2：设置返回图片颜色
//    navigationBar.tintColor = [UIColor colorWithWhite:0 alpha:0.6];

}
#pragma mark - 重写push方法,适当的时候隐藏下面的tabBar
-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    if (self.viewControllers.count > 0)
    {
        viewController.hidesBottomBarWhenPushed = YES;
        viewController.navigationController.navigationBar.alpha = 1;
    }
    
    //替换返回按钮
    viewController.navigationItem.backBarButtonItem =
    [[UIBarButtonItem alloc] initWithTitle:nil style:UIBarButtonItemStyleDone target:nil action:nil];
    [viewController.navigationItem.backBarButtonItem setTitle:@""];
    

    [super pushViewController:viewController animated:animated];
}

@end
